//+--------------------------------------------------------------------------------
//| Copyright (c) 2012 - 2013 ### an.vuongngocduy
//| This file is a part of Compact Game Engine (CGE)
//+--------------------------------------------------------------------------------
#ifndef __CGE_TEXTUREMANAGER_H__
#define __CGE_TEXTUREMANAGER_H__

#include "cgeSingleton.h"
#include "cgeString.h"
#include "cgeImage.h"
#include "cgeTexture.h"

using namespace cge::std;

namespace cge
{
	namespace gfx
	{
		class TextureManager : public Singleton<TextureManager>
		{
		friend Texture;

		public:
			//! Default constructor
			TextureManager();


			//! Destructor
			virtual ~TextureManager();


			//! Create a new texture from a file if no texture with 'name' is found
			virtual TexturePtr CreateOrRetrieveTexture(const String& filePath, const String& name = "");


			//! Create a new texture from image stored in memory
			virtual TexturePtr CreateOrRetrieveTexture(const Image& img, const String& name);


			//! Add a specified texture to texture group
			virtual b8 GroupTexture(const Texture& texture, const String& group);


			//! Delete and free a previous loaded texture
			virtual b8 RemoveTexture(const String& name);


			//! Release all loaded textures or all textures in group
			virtual b8 ClearTextures(const String& group = "");
		};
	}
}

#endif//__CGE_TEXTUREMANAGER_H__